﻿using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MSCacheSample.Infrastructure
{
    public class MemoryCachingProvider
               : ICachingProvider
    {
        private readonly IMemoryCache _memoryCache;
        public MemoryCachingProvider(IMemoryCache memoryCache)
        {
            _memoryCache = memoryCache;
        }
        public object Get(string cacheKey)
        {
            return _memoryCache.Get(cacheKey);
        }

        public void Set(string cacheKey, object value, DateTimeOffset expireTime)
        {
            _memoryCache.Set(cacheKey,value, expireTime);
        }
    }
}
